import request from '@/utils/base/request';
import { transformParams, AntiGravity } from '@/utils/base/utils';
import { sm2 } from 'sm-crypto';
import { apiAuth } from '@/utils/base/utils';

const pubkey =
  '039e4e357cf4fd771334f7bca8e152305b83a864c8862302283fd1a39519fdd8a2'; // 加
const api = '/api/gov/MapController';

/** 字典表 */
export async function getDictList(params) {
  const { menuName } = params;
  return request({
    url: `/api/gov/dict/getDict?${transformParams(params)}`,
    method: 'GET',
    headers: {
      ...AntiGravity(),
      menuName: menuName ? '04' + sm2.doEncrypt(menuName, pubkey, 1) : null,
    },
  });
}

/** 行业类型 */
export async function getAllIndustry(params) {
  const { menuName } = params;
  return request({
    url: `/api/gov/dict/getAllCarbonTrade?${transformParams(params)}`,
    method: 'GET',
    headers: {
      ...AntiGravity(),
      menuName: menuName ? '04' + sm2.doEncrypt(menuName, pubkey, 1) : null,
    },
  });
}

/** 获取全部主要国家信息（碳足迹对比用） */
export async function getCountryAll(params) {
  const { menuName } = params;
  return request({
    url: `/api/gov/area/country?${transformParams(params)}`,
    method: 'GET',
    headers: {
      ...AntiGravity(),
      menuName: menuName ? '04' + sm2.doEncrypt(menuName, pubkey, 1) : null,
    },
  });
}

/** 全球下拉数据  1.全球; 2.全国 */
export async function getWordAreaSel(params) {
  const { menuName } = params;
  return request({
    url: `/api/gov/area/all?${transformParams(params)}`,
    method: 'GET',
    headers: {
      ...AntiGravity(),
      menuName: menuName ? '04' + sm2.doEncrypt(menuName, pubkey, 1) : null,
    },
  });
}

/** 中国下拉数据  1.全球; 2.全国*/
export async function getChinaAreaSel(params) {
  const { menuName } = params;
  return request({
    url: `/api/gov/area/all?${transformParams(params)}`,
    method: 'GET',
    headers: {
      ...AntiGravity(),
      menuName: menuName ? '04' + sm2.doEncrypt(menuName, pubkey, 1) : null,
    },
  });
}

/** new 地区下拉接口 */
export async function getNewChinaAreaSel(params) {
  const { menuName } = params;
  return request({
    url: `/api/gov/area/chinaArea?${transformParams(params)}`,
    method: 'GET',
    headers: {
      ...AntiGravity(),
      menuName: menuName ? '04' + sm2.doEncrypt(menuName, pubkey, 1) : null,
    },
  });
}
